# !/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: 廖择贵
# createTime: 
# action: 读取yaml的配置文件

from ruamel import yaml


def read_yaml(file="../config/config.yaml", encoding="utf-8"):
    """ 读取yaml文件"""
    with open(file, encoding=encoding) as f:
        return yaml.load(f.read(), Loader=yaml.Loader)


def write_yaml(file="../config/config.yaml", data=None, encoding="utf-8"):
    """ 写入yaml文件"""
    with open(file, encoding=encoding, mode="w") as f:
        yaml.dump(data, stream=f, allow_unicode=True, Dumper=yaml.RoundTripDumper)


yaml_data = read_yaml()

